package com.xingxing.controller;

import com.xingxing.entity.StatusEntity;
import com.xingxing.service.ConsumeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: 小白一号
 * @date: 2022/11/18
 * @desc:
 */
@Slf4j
@RestController
@RequestMapping("/cost")
public class CostController {
    @Autowired
    private ConsumeService consumer;

    @GetMapping("/useWater")
    public Object userWater(@Param("userCardId") String userCardId, @Param("seconds") int seconds) {
        if (consumer.useWater(userCardId, seconds)) {
            return new StatusEntity("success","200");
        }
        return new StatusEntity("Error","302");
    }
}
